package o;

import androidx.annotation.Nullable;
import com.huawei.hms.framework.common.ContainerUtils;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Set;

abstract class dv<K, V> {
    @Nullable
    a ˊ;
    @Nullable
    d ˏ;
    @Nullable
    c ॱ;

    final class a implements Set<K> {
        final /* synthetic */ dv ˊ;

        a(dv dvVar) {
            this.ˊ = dvVar;
        }

        public boolean add(K k) {
            throw new UnsupportedOperationException();
        }

        public boolean addAll(Collection<? extends K> collection) {
            throw new UnsupportedOperationException();
        }

        public void clear() {
            this.ˊ.ॱ();
        }

        public boolean contains(Object obj) {
            return this.ˊ.ॱ(obj) >= 0;
        }

        public boolean containsAll(Collection<?> collection) {
            return dv.ˋ(this.ˊ.ˊ(), (Collection) collection);
        }

        public boolean isEmpty() {
            return this.ˊ.ˋ() == 0;
        }

        public Iterator<K> iterator() {
            return new e(this.ˊ, 0);
        }

        public boolean remove(Object obj) {
            int ॱ = this.ˊ.ॱ(obj);
            if (ॱ < 0) {
                return false;
            }
            this.ˊ.ˎ(ॱ);
            return true;
        }

        public boolean removeAll(Collection<?> collection) {
            return dv.ॱ(this.ˊ.ˊ(), (Collection) collection);
        }

        public boolean retainAll(Collection<?> collection) {
            return dv.ˏ(this.ˊ.ˊ(), (Collection) collection);
        }

        public int size() {
            return this.ˊ.ˋ();
        }

        public Object[] toArray() {
            return this.ˊ.ˋ(0);
        }

        public <T> T[] toArray(T[] tArr) {
            return this.ˊ.ˎ(tArr, 0);
        }

        public boolean equals(Object obj) {
            return dv.ˏ((Set) this, obj);
        }

        public int hashCode() {
            int i = 0;
            for (int ˋ = this.ˊ.ˋ() - 1; ˋ >= 0; ˋ--) {
                Object ॱ = this.ˊ.ॱ(ˋ, 0);
                i += ॱ == null ? 0 : ॱ.hashCode();
            }
            return i;
        }
    }

    final class b implements Iterator<Entry<K, V>>, Entry<K, V> {
        final /* synthetic */ dv ˊ;
        int ˋ;
        boolean ˎ = false;
        int ॱ;

        public /* synthetic */ Object next() {
            return ˎ();
        }

        b(dv dvVar) {
            this.ˊ = dvVar;
            this.ˋ = dvVar.ˋ() - 1;
            this.ॱ = -1;
        }

        public boolean hasNext() {
            return this.ॱ < this.ˋ;
        }

        public Entry<K, V> ˎ() {
            if (hasNext()) {
                this.ॱ++;
                this.ˎ = true;
                return this;
            }
            throw new NoSuchElementException();
        }

        public void remove() {
            if (this.ˎ) {
                this.ˊ.ˎ(this.ॱ);
                this.ॱ--;
                this.ˋ--;
                this.ˎ = false;
                return;
            }
            throw new IllegalStateException();
        }

        public K getKey() {
            if (this.ˎ) {
                return this.ˊ.ॱ(this.ॱ, 0);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        public V getValue() {
            if (this.ˎ) {
                return this.ˊ.ॱ(this.ॱ, 1);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        public V setValue(V v) {
            if (this.ˎ) {
                return this.ˊ.ˋ(this.ॱ, (Object) v);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        public boolean equals(Object obj) {
            boolean z = true;
            if (!this.ˎ) {
                throw new IllegalStateException("This container does not support retaining Map.Entry objects");
            } else if (!(obj instanceof Entry)) {
                return false;
            } else {
                Entry entry = (Entry) obj;
                if (!(dt.ˎ(entry.getKey(), this.ˊ.ॱ(this.ॱ, 0)) && dt.ˎ(entry.getValue(), this.ˊ.ॱ(this.ॱ, 1)))) {
                    z = false;
                }
                return z;
            }
        }

        public int hashCode() {
            int i = 0;
            if (this.ˎ) {
                Object ॱ = this.ˊ.ॱ(this.ॱ, 0);
                Object ॱ2 = this.ˊ.ॱ(this.ॱ, 1);
                int hashCode = ॱ == null ? 0 : ॱ.hashCode();
                if (ॱ2 != null) {
                    i = ॱ2.hashCode();
                }
                return i ^ hashCode;
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        public String toString() {
            return getKey() + ContainerUtils.KEY_VALUE_DELIMITER + getValue();
        }
    }

    final class c implements Collection<V> {
        final /* synthetic */ dv ˋ;

        c(dv dvVar) {
            this.ˋ = dvVar;
        }

        public boolean add(V v) {
            throw new UnsupportedOperationException();
        }

        public boolean addAll(Collection<? extends V> collection) {
            throw new UnsupportedOperationException();
        }

        public void clear() {
            this.ˋ.ॱ();
        }

        public boolean contains(Object obj) {
            return this.ˋ.ˏ(obj) >= 0;
        }

        public boolean containsAll(Collection<?> collection) {
            for (Object contains : collection) {
                if (!contains(contains)) {
                    return false;
                }
            }
            return true;
        }

        public boolean isEmpty() {
            return this.ˋ.ˋ() == 0;
        }

        public Iterator<V> iterator() {
            return new e(this.ˋ, 1);
        }

        public boolean remove(Object obj) {
            int ˏ = this.ˋ.ˏ(obj);
            if (ˏ < 0) {
                return false;
            }
            this.ˋ.ˎ(ˏ);
            return true;
        }

        public boolean removeAll(Collection<?> collection) {
            int i = 0;
            int ˋ = this.ˋ.ˋ();
            boolean z = false;
            while (i < ˋ) {
                if (collection.contains(this.ˋ.ॱ(i, 1))) {
                    this.ˋ.ˎ(i);
                    i--;
                    ˋ--;
                    z = true;
                }
                i++;
            }
            return z;
        }

        public boolean retainAll(Collection<?> collection) {
            int i = 0;
            int ˋ = this.ˋ.ˋ();
            boolean z = false;
            while (i < ˋ) {
                if (!collection.contains(this.ˋ.ॱ(i, 1))) {
                    this.ˋ.ˎ(i);
                    i--;
                    ˋ--;
                    z = true;
                }
                i++;
            }
            return z;
        }

        public int size() {
            return this.ˋ.ˋ();
        }

        public Object[] toArray() {
            return this.ˋ.ˋ(1);
        }

        public <T> T[] toArray(T[] tArr) {
            return this.ˋ.ˎ(tArr, 1);
        }
    }

    final class d implements Set<Entry<K, V>> {
        final /* synthetic */ dv ॱ;

        d(dv dvVar) {
            this.ॱ = dvVar;
        }

        public /* synthetic */ boolean add(Object obj) {
            return ˊ((Entry) obj);
        }

        public boolean ˊ(Entry<K, V> entry) {
            throw new UnsupportedOperationException();
        }

        public boolean addAll(Collection<? extends Entry<K, V>> collection) {
            int ˋ = this.ॱ.ˋ();
            for (Entry entry : collection) {
                this.ॱ.ˊ(entry.getKey(), entry.getValue());
            }
            return ˋ != this.ॱ.ˋ();
        }

        public void clear() {
            this.ॱ.ॱ();
        }

        public boolean contains(Object obj) {
            if (!(obj instanceof Entry)) {
                return false;
            }
            Entry entry = (Entry) obj;
            int ॱ = this.ॱ.ॱ(entry.getKey());
            if (ॱ >= 0) {
                return dt.ˎ(this.ॱ.ॱ(ॱ, 1), entry.getValue());
            }
            return false;
        }

        public boolean containsAll(Collection<?> collection) {
            for (Object contains : collection) {
                if (!contains(contains)) {
                    return false;
                }
            }
            return true;
        }

        public boolean isEmpty() {
            return this.ॱ.ˋ() == 0;
        }

        public Iterator<Entry<K, V>> iterator() {
            return new b(this.ॱ);
        }

        public boolean remove(Object obj) {
            throw new UnsupportedOperationException();
        }

        public boolean removeAll(Collection<?> collection) {
            throw new UnsupportedOperationException();
        }

        public boolean retainAll(Collection<?> collection) {
            throw new UnsupportedOperationException();
        }

        public int size() {
            return this.ॱ.ˋ();
        }

        public Object[] toArray() {
            throw new UnsupportedOperationException();
        }

        public <T> T[] toArray(T[] tArr) {
            throw new UnsupportedOperationException();
        }

        public boolean equals(Object obj) {
            return dv.ˏ((Set) this, obj);
        }

        public int hashCode() {
            int ˋ = this.ॱ.ˋ() - 1;
            int i = 0;
            while (ˋ >= 0) {
                int i2;
                Object ॱ = this.ॱ.ॱ(ˋ, 0);
                Object ॱ2 = this.ॱ.ॱ(ˋ, 1);
                int hashCode = ॱ == null ? 0 : ॱ.hashCode();
                if (ॱ2 == null) {
                    i2 = 0;
                } else {
                    i2 = ॱ2.hashCode();
                }
                ˋ--;
                i += i2 ^ hashCode;
            }
            return i;
        }
    }

    final class e<T> implements Iterator<T> {
        final /* synthetic */ dv ˊ;
        int ˋ;
        int ˎ;
        boolean ˏ = false;
        final int ॱ;

        e(dv dvVar, int i) {
            this.ˊ = dvVar;
            this.ॱ = i;
            this.ˋ = dvVar.ˋ();
        }

        public boolean hasNext() {
            return this.ˎ < this.ˋ;
        }

        public T next() {
            if (hasNext()) {
                T ॱ = this.ˊ.ॱ(this.ˎ, this.ॱ);
                this.ˎ++;
                this.ˏ = true;
                return ॱ;
            }
            throw new NoSuchElementException();
        }

        public void remove() {
            if (this.ˏ) {
                this.ˎ--;
                this.ˋ--;
                this.ˏ = false;
                this.ˊ.ˎ(this.ˎ);
                return;
            }
            throw new IllegalStateException();
        }
    }

    protected abstract Map<K, V> ˊ();

    protected abstract void ˊ(K k, V v);

    protected abstract int ˋ();

    protected abstract V ˋ(int i, V v);

    protected abstract void ˎ(int i);

    protected abstract int ˏ(Object obj);

    protected abstract int ॱ(Object obj);

    protected abstract Object ॱ(int i, int i2);

    protected abstract void ॱ();

    dv() {
    }

    public static <K, V> boolean ˋ(Map<K, V> map, Collection<?> collection) {
        for (Object containsKey : collection) {
            if (!map.containsKey(containsKey)) {
                return false;
            }
        }
        return true;
    }

    public static <K, V> boolean ॱ(Map<K, V> map, Collection<?> collection) {
        int size = map.size();
        for (Object remove : collection) {
            map.remove(remove);
        }
        return size != map.size();
    }

    public static <K, V> boolean ˏ(Map<K, V> map, Collection<?> collection) {
        int size = map.size();
        Iterator it = map.keySet().iterator();
        while (it.hasNext()) {
            if (!collection.contains(it.next())) {
                it.remove();
            }
        }
        return size != map.size();
    }

    public Object[] ˋ(int i) {
        int ˋ = ˋ();
        Object[] objArr = new Object[ˋ];
        for (int i2 = 0; i2 < ˋ; i2++) {
            objArr[i2] = ॱ(i2, i);
        }
        return objArr;
    }

    public <T> T[] ˎ(T[] tArr, int i) {
        T[] tArr2;
        int ˋ = ˋ();
        if (tArr.length < ˋ) {
            tArr2 = (Object[]) Array.newInstance(tArr.getClass().getComponentType(), ˋ);
        } else {
            tArr2 = tArr;
        }
        for (int i2 = 0; i2 < ˋ; i2++) {
            tArr2[i2] = ॱ(i2, i);
        }
        if (tArr2.length > ˋ) {
            tArr2[ˋ] = null;
        }
        return tArr2;
    }

    public static <T> boolean ˏ(Set<T> set, Object obj) {
        boolean z = true;
        if (set == obj) {
            return true;
        }
        if (!(obj instanceof Set)) {
            return false;
        }
        Set set2 = (Set) obj;
        try {
            if (!(set.size() == set2.size() && set.containsAll(set2))) {
                z = false;
            }
            return z;
        } catch (NullPointerException e) {
            return false;
        } catch (ClassCastException e2) {
            return false;
        }
    }

    public Set<Entry<K, V>> ˎ() {
        if (this.ˏ == null) {
            this.ˏ = new d(this);
        }
        return this.ˏ;
    }

    public Set<K> ˏ() {
        if (this.ˊ == null) {
            this.ˊ = new a(this);
        }
        return this.ˊ;
    }

    public Collection<V> ॱॱ() {
        if (this.ॱ == null) {
            this.ॱ = new c(this);
        }
        return this.ॱ;
    }
}
